<template>
  <div>
    <input v-model="inputText" placeholder="请输入内容" />
    <div v-if="inputText">{{ inputText }}</div>
    <br>
    <button @click="clearText">清空</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      inputText: ''
    };
  },
  methods: {
    clearText() {
      this.inputText = '';
    }
  }
};
</script>

<style scoped>
input {
  border: 1px solid #ccc; 
  border-radius: 4px; 
  padding: 8px; 
}
</style>